<?php
ini_set("display_errors",true);
error_reporting(E_ALL ^ E_NOTICE);

include dirname(__FILE__) . '/mysecurimage.php';

/*
	settings:
	- fname: filename for this image
	- char: list of allowed characters to be displayed
	- level: perturbation/distortion level, min=0, max=1
	- width: image width
	- height: image height
	- length: number of chars in the image
	- lines: number of lines
	- textR: R component of text color
	- textG: G component of text color
	- textB: B component of text color
	- lineR: R component of line color
	- lineG: G component of line color
	- minAngle: minimum angle of text rotation
	- maxAngle: maximum angle of text rotation
		
*/

/* === BEGIN global default settings ===*/

// no distortion
$settings['level'] = 0;

// white background
$settings['bgR'] = 255;
$settings['bgG'] = 255;
$settings['bgB'] = 255;

// black text
$settings['textR'] = 0;
$settings['textG'] = 0;
$settings['textB'] = 0;

// no lines 
$settings['lines'] = 0;

// black lines
$settings['lineR'] = 0;
$settings['lineG'] = 0;
$settings['lineB'] = 0;

// no text rotation
$settings['minAngle'] = 0;
$settings['maxAngle'] = 0;

// dont show image to browser
$settings['show'] = 0;

/* === END global default settings ===*/


/* === BEGIN override settings from url ===*/

foreach($_GET as $param=>$value)
{
	$settings[$param] = $value;
}

/* === END override settings from url ===*/

$img = new MySecurimage();

$img->show = $settings['show'];
$img->fname = $settings['fname'];

$img->image_width = $settings['width'];
$img->image_height = $settings['height'];

// charset
$img->charset = $settings['char'];

// num of char
$img->code_length = $settings['length'];

// letter distortion
$img->perturbation = $settings['level'];

// white bg
$img->image_bg_color = new Securimage_Color($settings['bgR'],$settings['bgG'],$settings['bgB']);

// black text
$img->text_color = new Securimage_Color($settings['textR'],$settings['textG'],$settings['textB']);

// solid text
$img->text_transparency_percentage = 0;

// no lines
$img->num_lines = $settings['lines'];
$img->line_color = new Securimage_Color($settings['lineR'],$settings['lineG'],$settings['lineB']);

// range of angle rotation
$img->text_angle_minimum = $settings['minAngle'];
$img->text_angle_maximum = $settings['maxAngle'];

// image type
$img->image_type = SI_IMAGE_GIF;

$img->show();

// convert img to bmp

?>
